<%@ page import="java.util.List" %>
<h3>Account Information</h3>

<table>
  <tr>
    <td>First name:</td>
    <td><%--<stripes:text name="account.firstName" />--%>
      <input type="text" name="account.firstName" placeholder="Required"
             value="${sessionScope.account.firstName}">
    </td>
  </tr>
  <tr>
    <td>Last name:</td>
    <td><%--<stripes:text name="account.lastName" />--%>
      <input type="text" name="account.lastName" placeholder="Required" value="${sessionScope.account.lastName}">
    </td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><%--<stripes:text size="40" name="account.email" />--%>
      <input type="text" name="account.email" placeholder="Required" value="${sessionScope.account.email}">
    </td>
  </tr>
  <tr>
    <td>Phone:</td>
    <td><%--<stripes:text name="account.phone" />--%>
      <input type="text" name="account.phone" placeholder="Required" value="${sessionScope.account.phone}">
    </td>
  </tr>
  <tr>
    <td>Address 1:</td>
    <td><%--<stripes:text size="40" name="account.address1" />--%>
      <input type="text" name="account.address1" placeholder="Required" value="${sessionScope.account.address1}">
    </td>
  </tr>
  <tr>
    <td>Address 2:</td>
    <td><%--<stripes:text size="40" name="account.address2" />--%>
      <input type="text" name="account.address2" value="${sessionScope.account.address2}">
    </td>
  </tr>
  <tr>
    <td>City:</td>
    <td><%--<stripes:text name="account.city" />--%>
      <input type="text" name="account.city" placeholder="Required" value="${sessionScope.account.city}">
    </td>
  </tr>
  <tr>
    <td>State:</td>
    <td><%--<stripes:text size="4" name="account.state" />--%>
      <input type="text" name="account.state" placeholder="Required" value="${sessionScope.account.state}">
    </td>
  </tr>
  <tr>
    <td>Zip:</td>
    <td><%--<stripes:text size="10" name="account.zip" />--%>
      <input type="text" name="account.zip" placeholder="Required" value="${sessionScope.account.zip}">
    </td>
  </tr>
  <tr>
    <td>Country:</td>
    <td><%--<stripes:text size="15" name="account.country" />--%>
      <input type="text" name="account.country" placeholder="Required" value="${sessionScope.account.country}">
    </td>
  </tr>
</table>

<h3>Profile Information</h3>

<table>
  <tr>
    <td>Language Preference:</td>
    <td><%--<stripes:select name="account.languagePreference">
			<stripes:options-collection collection="${actionBean.languages}" />
		</stripes:select>--%>
        <%--<option value="${sessionScope.languages}"></option>--%>
<%--      <select name="account.languagePreference" id="">--%>
<%--        <c:forEach items="${sessionScope.languages}" var="language">--%>
<%--          <option value="${language}"--%>
<%--                  <c:if test="${sessionScope.account.languagePreference==language}">selected</c:if>>${language}</option>--%>
<%--        </c:forEach>--%>
<%--      </select>--%>
      <select name="account.languagePreference" id="">
        <%
          List<String> languages = (List<String>) session.getAttribute("languages");
          String languagePreference = (String) session.getAttribute("account.languagePreference");

          if (languages != null) {
            for (String language : languages) {
              boolean selected = language.equals(languagePreference);
        %>
        <option value="<%= language %>" <%= selected ? "selected" : "" %>><%= language %></option>
        <%
            }
          }
        %>
      </select>
    </td>
  </tr>
  <tr>
    <td>Favourite Category:</td>
    <td><%--<stripes:select name="account.favouriteCategoryId">
			<stripes:options-collection collection="${actionBean.categories}" />
		</stripes:select>--%>
        <%--<option value="${sessionScope.categories}"></option>--%>
<%--      <select name="account.favouriteCategoryId" id="">--%>
<%--        <c:forEach items="${sessionScope.categories}" var="category">--%>
<%--          <option value="${category}"--%>
<%--                  <c:if test="${sessionScope.account.favouriteCategoryId==category}">selected</c:if>>--%>
<%--              ${category}--%>
<%--          </option>--%>
<%--        </c:forEach>--%>
<%--      </select>--%>
      <select name="account.favouriteCategoryId" id="">
        <%
          List<String> categories = (List<String>) session.getAttribute("categories");
          String favouriteCategoryId = (String) session.getAttribute("account.favouriteCategoryId");

          if (categories != null) {
            for (String category : categories) {
              boolean selected = category.equals(favouriteCategoryId);
        %>
        <option value="<%= category %>" <%= selected ? "selected" : "" %>><%= category %></option>
        <%
            }
          }
        %>
      </select>
    </td>
  </tr>
  <tr>
    <td>Enable MyList</td>
    <td>
      <%--<stripes:checkbox name="account.listOption" />--%>
<%--      <input type="checkbox" name="account.listOption"--%>
<%--             <c:if test="${sessionScope.account.listOption==true}">checked</c:if>>--%>
      <input type="checkbox" name="account.listOption"
        <%
               Boolean listOption = (Boolean) session.getAttribute("account.listOption");
               if (listOption != null && listOption) {
             %>
             checked
        <%
               }
             %>
      >
    </td>
  </tr>
  <tr>
    <td>Enable MyBanner</td>
    <td>
      <%--<stripes:checkbox name="account.bannerOption" />--%>
<%--      <input type="checkbox" name="account.bannerOption"--%>
<%--             <c:if test="${sessionScope.account.bannerOption==true}">checked</c:if>>--%>
      <input type="checkbox" name="account.bannerOption"
        <%
               Boolean bannerOption = (Boolean) session.getAttribute("account.bannerOption");
               if (bannerOption != null && bannerOption) {
             %>
             checked
        <%
               }
             %>
      >
    </td>
  </tr>

</table>
<P style="color:red;">${sessionScope.messageWarning}</P>
